package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.api.db.TestDimensionApi;
import com.tanhua.dubbo.api.mapper.TestDimensionMapper;
import com.tanhua.model.db.Dimension;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 提交问卷题目维度服务实现类
 */
@DubboService
public class TestDimensionApiImpl implements TestDimensionApi {

    @Autowired
    private TestDimensionMapper testDimensionMapper;

    /**
     * 根据维度id查询在对应的维度名称
     *
     * @param dimensionId
     * @return
     */
    @Override
    public String findDimensionId(Integer dimensionId) {
        QueryWrapper<Dimension> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("id", dimensionId);
        Dimension dimension = testDimensionMapper.selectOne(queryWrapper);
        return dimension.getName();
    }
}
